/*
 * 供应商管理API
 *
 * @Author:    1024创新实验室
 * @Date:      2024-07-19 20:30:00
 * @Wechat:    zhuoda1024
 * @Email:     lab1024@163.com
 * @Copyright  1024创新实验室 （ https://1024lab.net ），Since 2012
 */
import { getRequest, postRequest } from '/@/lib/axios';

export const supplierApi = {
  // 分页查询供应商列表
  queryPage: (param) => {
    return postRequest('/purchase/supplier/page', param);
  },

  // 添加供应商
  add: (param) => {
    return postRequest('/purchase/supplier/add', param);
  },

  // 更新供应商
  update: (param) => {
    return postRequest('/purchase/supplier/update', param);
  },

  // 删除供应商
  delete: (supplierId) => {
    return getRequest(`/purchase/supplier/delete/${supplierId}`);
  },

  // 查询供应商详情
  queryDetail: (supplierId) => {
    return getRequest(`/purchase/supplier/${supplierId}`);
  },

  // 启用/禁用供应商
  updateStatus: (supplierId, status) => {
    return postRequest(`/purchase/supplier/updateStatus?supplierId=${supplierId}&status=${status}`);
  },

  // 获取所有启用的供应商列表
  queryEnabledList: () => {
    return getRequest('/purchase/supplier/enabled/list');
  },
};